import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: "/home",
    name: "home",
    component: () => import("@/views/tabbar/Home.vue")
  },
  {
    path: "/home/newsList",
    component: () => import("@/views/news/NewsList.vue")
  },
  {
    path: "/home/newsList/newsInfo/:id",
    component: () => import("@/views/news/NewsInfo.vue")
  },
  {
    path: "/home/pictureList",
    component: () => import("@/views/picture/PictureList.vue")
  },
  {
    path: "/home/pictureList/pictureInfo/:id",
    component: () => import("@/views/picture/PictureInfo.vue")
  },
  {
    path: "/home/goodsList",
    component: () => import("@/views/goods/GoodsList.vue")
  },
  {
    path: "/home/goodsList/goodsInfo/:id",
    name: "goodsInfo",
    component: () => import("@/views/goods/GoodsInfo.vue")
  },
  {
    path: "/shopcart",
    component: () => import("@/views/tabbar/ShopCart.vue")
  },
  {
    path: "/my",
    component: () => import("@/views/tabbar/My.vue")
  },
  {
    path: "/login",
    component: () => import("@/views/login/Login")
  },
  {
    path: "/register",
    component: () => import("@/views/login/Register")
  },
  {
    path: "/my/business",
    component: () => import("@/views/manage/business/Business.vue")
  },
  {
    path: "/my/business/addGoods",
    component: () => import("@/views/manage/business/AddGoods.vue")
  },
  {
    path: "/my/business/editGoods",
    component: () => import("@/views/manage/business/EditGoods.vue")
  },
  {
    path: "/admin",
    component: () => import("@/views/manage/admin/Admin.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
